
class Circle:
    def __init__(self,radius):
        self._radius = radius

    @property
    def radius(self):
        return self._radius

    @radius.setter
    def radius(self,value):
        if value <0:
            raise ValueError("半径不能为负值")
        self._radius = value

#内置装饰器
    @property
    def area(self):
        return 3.14159 * self._radius ** 2
c = Circle(5)
print(c.area)
c.radius = 10
print(c.area)